package com.write;

import com.enums.DataTypeEnum;
import com.enums.WriteDataHandleEnum;
import com.reflect.ReflectUtil;
import org.apache.commons.lang3.StringUtils;

public class WriteUtil {

    /**
     * 获取写入数据类
     *
     * @param dataTypeEnum
     * @return
     */
    public static WriteDataHandle writeDataHandle(DataTypeEnum dataTypeEnum, String writeHandleClassName) {
        WriteDataHandle writeDataHandle = WriteDataHandleEnum.writeDataHandle(dataTypeEnum);
       try {
           if (!StringUtils.isEmpty(writeHandleClassName)) {
               writeDataHandle = (WriteDataHandle) ReflectUtil.newInstance(Class.forName(writeHandleClassName));
           }
       } catch (Exception e) {
           e.printStackTrace();
       }
        return writeDataHandle;
    }

}
